<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('人员签到信息列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>姓名：</label>
                            <input type="text" name="realname"/>
                            <input type="hidden" name="meetingId" th:value="${meetingId}"/>
                        </li>
                        <li>
                            <label>手机号：</label>
                            <input type="text" name="phone"/>
                        </li>
                        <!--<li>
                            <label>职务：</label>
                            <input type="text" name="post"/>
                        </li>-->
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:record:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('business:record:edit')}]];
    var removeFlag = [[${@permission.hasPermi('business:record:remove')}]];
    var prefix = ctx + "business/record";

    $(function () {
        var options = {
            url: prefix + "/list/",
            exportUrl: prefix + "/export",
            modalName: "人员签到信息",
            columns: [{
                field: 'rowNum',
                title: '序号',
                width: 60,
                align: 'center',
                formatter: function (value, row, index) {
                    // index是从0开始的，所以+1得到从1开始的行号
                    return index + 1;
                }
            },
                {
                    field: 'id',
                    title: '签到ID',
                    visible: false
                },
                {
                    field: 'meetingId',
                    title: '会议ID',
                    visible: false
                },
                {
                    field: 'realname',
                    title: '姓名'
                },
                {
                    field: 'phone',
                    title: '手机号'
                },
                /*{
                    field: 'post',
                    title: '职务'
                },*/
                {
                    field: 'attendFlag',
                    title: '是否参加',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return '<span class="badge badge-success">是</span>';
                        } else {
                            return '<span class="badge badge-danger">否</span>';
                        }
                    }
                },
                {
                    field: 'leaveType',
                    title: '请假类别',
                    formatter: function (value, row, index) {
                        if (row.attendFlag == 0 ) {
                            //0=门诊,1=手术,2=会议,3=因公学习,4=外事,5=医联体,6=年休,7=病假,8=其他
                            if (value == 0) {
                                return '<span class="badge badge-primary">门诊</span>';
                            } else if (value == 1) {
                                return '<span class="badge badge-primary">手术</span>';
                            } else if (value == 2) {
                                return '<span class="badge badge-primary">会议</span>';
                            } else if (value == 3) {
                                return '<span class="badge badge-primary">因公学习</span>';
                            } else if (value == 4) {
                                return '<span class="badge badge-primary">外事</span>';
                            } else if (value == 5) {
                                return '<span class="badge badge-primary">医联体</span>';
                            } else if (value == 6) {
                                return '<span class="badge badge-primary">年休</span>';
                            } else if (value == 7) {
                                return '<span class="badge badge-primary">病假</span>';
                            } else if (value == 8) {
                                return '<span class="badge badge-primary">其他</span>';
                            } else {
                                return '';
                            }
                        } else {
                            return '';
                        }
                    }
                },
                {
                    field: 'leaveReason',
                    title: '请假原因'
                    // },
                    // {
                    //     field: 'remark',
                    //     title: '备注'
                    // },
                    // {
                    //     title: '操作',
                    //     align: 'center',
                    //     formatter: function(value, row, index) {
                    //         var actions = [];
                    //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                    //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                    //         return actions.join('');
                    //     }
                },
                {
                    field: 'attachment',
                    title: '附件',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return '<a href="javascript:void(0)" onclick="$.operate.download(\'' + row.attachment + '\')">下载</a>';
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>